home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-09-28 | 1.4 KB | 57 lines | [TEXT/CWIE] |
- unit ICDebug;
-
- (* This file is part of the Internet Configuration system and is placed in the public domain for the benefit of all.
-
- Useful debugging macros and such.
- *)
-
- interface
-
- uses
- Types; // Make sure to pick up DebugStr!
-
- {$ifc undefined icDebug}
- {$setc icDebug:=false}
- {$endc}
-
- {$ifc icDebug}
- {$definec ICAssert(mustBeTrue) begin if not (mustBeTrue) then DebugStr('ICAssert: Assertion failed! ; sc') end}
- {$definec ICDebugStr(message) begin DebugStr('ICDebugStr: ' + message + '; sc') ; end}
-
- {$definec ICParamCheck(err, mustBeTrue, message) begin if (err = noErr) & not (mustBeTrue) then begin ICDebugStr('ICParamCheck: ' + message + '; sc'); err := paramErr; end; end}
- {$elsec}
- {$definec ICAssert(mustBeTrue) }
- {$definec ICDebugStr(message) }
- {$definec ICParamCheck(err, mustBeTrue, message) begin if (err = noErr) & not (mustBeTrue) then begin err := paramErr; end; end}
- {$endc}
-
-
- implementation
-
- uses
- Errors;
-
- procedure ICDebugTest;
- var
- err : OSStatus;
- a, b : integer;
- begin
- a := 1;
- b := 1;
- ICAssert(a = b);
- ICDebugStr('abcd');
- err := noErr;
- ICParamCheck(err, a = b, 'abcd');
- end; (* Test *)
-
- {$ifc false}
- procedure ICParamCheck(var err : OSStatus; mustBeTrue : Boolean; message : Str255);
- begin
- if (err = noErr) & not mustBeTrue then begin
- ICDebugStr(message);
- err := paramErr;
- end; (* if *)
- end; (* ICParamCheck *)
- {$endc}
-
- end. (* ICDebug *)